package com.wish.wishsystem_management.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wish.wishsystem_management.entity.SysLog;
import com.wish.wishsystem_management.mapper.SysLogMapper;
import com.wish.wishsystem_management.service.ISysLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import dto.systemDto.SysLogDto;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 系统日志表 服务实现类
 * </p>
 *
 * @author zhaiwj
 * @since 2021-03-22
 */
@Service
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements ISysLogService {
    @Resource
    private SysLogMapper sysLogMapper;

    @Override
    public PageInfo<SysLogDto> list(SysLogDto sysLogDto) {
        PageHelper.startPage(sysLogDto.getPageNum(), sysLogDto.getPageSize());
        List<SysLogDto> list = sysLogMapper.list(sysLogDto);
        return new PageInfo<SysLogDto>(list);
    }

    @Override
    public void save(SysLogDto sysLogDto) {
        sysLogMapper.insert(sysLogDto);
    }

    @Override
    public void delete(Long id) {
        sysLogMapper.delete(id);
    }

    @Override
    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
            sysLogMapper.delete(id);
        }
    }
}
